import { Column, DataType, Model, PrimaryKey, Table } from 'sequelize-typescript';

import type { FileType, SubmitterAttributes } from '@/utils/types/administrative';

@Table({ tableName: 'submitter' })
export class Submitter
  extends Model<SubmitterAttributes, SubmitterAttributes>
  implements SubmitterAttributes
{
  @PrimaryKey
  @Column({
    type: DataType.UUID,
    allowNull: false,
    defaultValue: DataType.UUIDV4,
    comment: '主键id',
    primaryKey: true,
  })
  id: string;

  @Column({
    type: DataType.UUID,
    allowNull: false,
    comment: '任务id',
  })
  task_id: string;

  @Column({
    type: DataType.UUID,
    allowNull: false,
    comment: '用户id',
  })
  user_id: string;

  @Column({
    type: DataType.STRING,
    allowNull: true,
    comment: '文件路径',
  })
  file_path: string;

  @Column({
    type: DataType.STRING,
    allowNull: true,
    comment: '提交的文件类型',
  })
  file_type: FileType;

  @Column({
    type: DataType.DATE,
    allowNull: true,
    comment: '提交时间',
  })
  submit_time: Date;

  @Column({
    type: DataType.INTEGER,
    allowNull: false,
    comment: '状态',
    defaultValue: 0,
  })
  status: number;

  @Column({
    type: DataType.STRING,
    allowNull: true,
    comment: '审核意见',
    defaultValue: '',
  })
  recommend: string;

  @Column({
    type: DataType.STRING,
    allowNull: true,
    comment: '用户名',
  })
  user_name: string;
}
